<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Person{
            constructor(name,age,sex){
                this.name = name;
                this.age = age;
                this.sex = sex;
            }

            print(){
                console.log(this.name + "----" + this.age + "----" + this.sex);
            }
        }

        let p1 = new Person("root",22,"女");
        p1.print();

        //继承 js在没有类之前是靠原型链实现的继承
        class Chinese extends Person {
            constructor(name,age,sex,guoji){
                super(name,age,sex);
                this.guoji = guoji;
            }

            print(){
                console.log(this.guoji  + "----" + this.name + "----" + this.age + "----" + this.sex);
            }
        }

        let chinese = new Chinese("admin",32,"男","中国");
        chinese.print();




    </script>
</body>
</html>